from jinja2 import Environment, FileSystemLoader

# 示例数据
probability_data = [
    {
        "enroll_num": 2,
        "major": "材料科学与工程（办学点:江浦校区）",
        "major_code": "08",
        "major_group": "02",
        "probability": "0.01",
        "school": "南京工业大学",
        "school_code": "433"
    },
    {
        "enroll_num": 5,
        "major": "生物科学类（含生物科学、生物技术专业）（办学点:校本部）",
        "major_code": "02",
        "major_group": "01",
        "probability": "0.01",
        "school": "广西大学",
        "school_code": "794"
    },
    {
        "enroll_num": 1,
        "major": "电气工程及其自动化（办学点:扬州）",
        "major_code": "08",
        "major_group": "02",
        "probability": "0.011",
        "school": "扬州大学",
        "school_code": "453"
    }
]

# 创建 Jinja2 环境并加载模板
env = Environment(loader=FileSystemLoader('.'))
# template = env.get_template('volunteer_template.j2')
template = env.get_template('print_data_template.j2')

# 渲染模板
output = template.render(probability_data=probability_data)

# 输出结果
print(output)